package main

import (
	maker2 "api/libs/maker"
	"gitee.com/dreamwood/ez-maker/maker"
)

func main() {
	maker2.Prepare()
	Notice()
	NoticeType()
	NoticeRead()
}

func Notice() {
	c := maker.CreateTable("Notice", "通知公告", "oa")
	c.AddText("title", "标题").SetNullable(true).SetLength(255)
	c.AddArt("content", "正文").SetNullable(true)
	c.AddManyToOne("type", "信息类型", "NoticeType").SetNullable(true)

	c.AddText("createName", "发布人")
	c.AddText("checkName", "审核人")

	c.AddDateTime("createAt", "创建时间").SetIsAutoNowAdd(true)
	c.AddInt("reads", "阅读").SetNullable(true)

	//c.AddBool("isSend", "是否已发送")
	c.Generate()
}

func NoticeType() {
	c := maker.CreateTable("NoticeType", "消息类型", "oa")
	c.AddText("name", "类型名称").SetNullable(true).SetLength(255)
	c.LoadTree()
	c.Generate()
}

func NoticeRead() {
	c := maker.CreateTable("NoticeRead", "消息阅读记录", "oa")
	c.AddInt("userId", "用户Id")
	c.AddManyToOne("notice", "消息", "Notice")
	c.AddBool("isRead", "是否已读")
	c.AddCreateAt()
	c.AddUpdateAt()
	c.Generate()
}
